package com.zdsoft.blp.zongbuju.shouye.linliquan.activity;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zdsoft.blp.R;
import com.zdsoft.blp.gongyong.isLoginSuccess.IsLoginSuccess;
import com.zdsoft.blp.gongyong.linliFragment.LinLiView;
import com.zdsoft.blp.gongyong.net.BaseActivity;
import com.zdsoft.blp.zongbuju.shouye.linliquan.adapter.PCfragmentAdapter;
import com.zdsoft.blp.zongbuju.shouye.linliquan.fragment.ZPfragmentLeft;
import com.zdsoft.blp.zongbuju.shouye.linliquan.fragment.ZPfragmentRight;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/8/31.
 */
public class LLZhaoPinActivity extends BaseActivity {
    private LinLiView llv;          //封装的viewPager+fragment
    private TextView tv_title;      //封装的标题
    private ImageView title_bianji;//编辑图片
    private List<Fragment> fragments;
    public int source;
    private Intent intent;
    @Override
    protected void init() {
        setContentView(R.layout.linli_pinchexinxi);
        llv = find(R.id.llv);
        intent=getIntent();
        source=intent.getIntExtra("source",1);

        //图片跳转到编辑页面
        title_bianji = find(R.id.title_bianji);
        title_bianji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (IsLoginSuccess.isloginSuccess(LLZhaoPinActivity.this,true)){
                    Intent intent = new Intent(LLZhaoPinActivity.this,FBTYActivity.class);
                    if(llv.isChack()){
                        intent.putExtra("title","招聘发布");
                        intent.putExtra("aSource","招聘");
                    }else{
                        intent.putExtra("title","求职发布");
                        intent.putExtra("aSource","求职");
                    }
                    startActivity(intent);
                }

            }
        });
        //设置标题
        tv_title = find(R.id.tv_title);
        tv_title.setText("求职招聘");
        llv.getTv_left().setText("招聘");
        llv.getTv_right().setText("求职");
        //加载fragment布局
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new ZPfragmentLeft());
        fragments.add(new ZPfragmentRight());
        llv.getVp().setAdapter(new PCfragmentAdapter(getSupportFragmentManager(),fragments));

    }
}
